<UserControl x:Class="gestadh45.wpf.UserControls.GroupesUC.GestionGroupesUC"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
 	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
	xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
	xmlns:uc="clr-namespace:gestadh45.wpf.UserControls"
 	xmlns:enum="clr-namespace:gestadh45.business.Enums;assembly=gestadh45.business"
 	xmlns:model="clr-namespace:gestadh45.model;assembly=gestadh45.model"
	xmlns:res="clr-namespace:gestadh45.wpf.Ressources"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
 	mc:Ignorable="d" 
 	d:DesignHeight="500" d:DesignWidth="600">
	<DockPanel Margin="5,5,5,5">
		<TextBlock DockPanel.Dock="Top"
			Text="{Binding Source={x:Static enum:CodesUC.GestionGroupes}, Converter={StaticResource ResourceKey=CodeUCToString}}"
			HorizontalAlignment="Stretch" Margin="0,5,0,10" 
			TextAlignment="Center" Style="{StaticResource ResourceKey=titreUC}" />
	
		<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Center">
			<Button ToolTip="{x:Static res:UI_Labels.Tltp_Enregistrer}" Margin="10,5,5,5" 
			        Style="{StaticResource ResourceKey=bigButton}"
					Command="{Binding Path=SaveItemCommand}">
				<Image Source="/gestadh45.wpf;component/Images/btn_save.png" />
			</Button>
		</StackPanel>
		
		<TextBox Name="tbxFiltre" Margin="0,0,0,10" DockPanel.Dock="Top" Width="300" HorizontalAlignment="Left">
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="TextChanged">
					<cmd:EventToCommand
								Command="{Binding Path=FilterCommand, Mode=OneWay}"
								CommandParameter="{Binding ElementName=tbxFiltre, Path=Text}" />
				</i:EventTrigger>
			</i:Interaction.Triggers>
		</TextBox>
		
		<ListBox Name="lbxItems" Width="300" DockPanel.Dock="Left"
				 ItemsSource="{Binding Path=Items}">
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="SelectionChanged">
					<cmd:EventToCommand 
						Command="{Binding Path=ShowDetailsCommand, Mode=OneWay}" 
						CommandParameter="{Binding ElementName=lbxItems, Path=SelectedItem}" />
				</i:EventTrigger>
			</i:Interaction.Triggers>
		</ListBox>
	
		<StackPanel Orientation="Vertical">		
		<uc:BtnAjouterEditerSupprimerUC 
			DockPanel.Dock="Left" VerticalAlignment="Center" Margin="10,10,10,10"
			OrientationUC="Vertical"
			BtnAjouterVisibilite="Visible"
			BtnModifierVisibilite="Collapsed"
			BtnSupprimerVisibilite="Visible"
			CmdAjouter="{Binding Path=AddItemCommand}"
			CmdSupprimer="{Binding Path=DeleteItemCommand}"
			/>
		
			<Separator />
		
			<Button ToolTip="{x:Static res:UI_Labels.Tltp_ExtractionEmails}" Margin="10,10,10,10"
					Style="{StaticResource ResourceKey=bigButton}"
					Command="{Binding Path=ExtraireEmailsCommand}">
				<Image Source="/gestadh45.wpf;component/Images/btn_search.png" />
			</Button>
		</StackPanel>
	
		<ScrollViewer VerticalScrollBarVisibility="Auto" CanContentScroll="True" DockPanel.Dock="Right">
			<StackPanel Margin="20,0,0,0" Orientation="Vertical">
				<StackPanel.Style>
					<Style TargetType="{x:Type StackPanel}">
						<Setter Property="IsEnabled" Value="True" />
					
						<Style.Triggers>
							<DataTrigger Binding="{Binding SelectedItem}" Value="{x:Null}">
								<Setter Property="IsEnabled" Value="False" />
							</DataTrigger>
						</Style.Triggers>
					</Style>
				</StackPanel.Style>
					
				<GroupBox Name="gbxInfos" Header="{x:Static res:UI_Labels.Head_Informations}" Margin="0,0,0,10">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="75" />
							<ColumnDefinition Width="100" />
							<ColumnDefinition Width="50" />
							<ColumnDefinition Width="100" />
						</Grid.ColumnDefinitions>
					
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
						</Grid.RowDefinitions>
					
						<TextBlock Grid.Row="0" Grid.Column="0" Margin="0,5,0,0"
						           Text="{x:Static res:UI_Labels.Groupe_Libelle}" />
						<TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,5,0,0"
						         CharacterCasing="Upper"
						         Text="{Binding Path=SelectedItem.Libelle}" />
					
						<TextBlock Grid.Row="1" Grid.Column="0" Margin="0,5,0,0"
						           Text="{x:Static res:UI_Labels.Groupe_Jour}" />
						<ComboBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,5,0,0"
						          ItemsSource="{Binding Path=JoursSemaine}" 
						          SelectedItem="{Binding Path=SelectedItem.JourSemaine}" />
					
						<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,5,0,0"
						           Text="{x:Static res:UI_Labels.Groupe_Horaire}" />					
						<xctk:TimePicker Grid.Row="2" Grid.Column="1" Margin="0,5,0,0" 
						                 Value="{Binding Path=SelectedItem.HeureDebut}" 
						                 Format="LongTime"
						                 Background="White"	/>
						<TextBlock Grid.Row="2" Grid.Column="2" Margin="0,5,0,0" HorizontalAlignment="Center"
						           Text="{x:Static res:UI_Labels.Groupe_HoraireSeparateur}" />
						<xctk:TimePicker Grid.Row="2" Grid.Column="3" Margin="0,5,0,0" 
						                 Value="{Binding Path=SelectedItem.HeureFin}" 
						                 Format="LongTime" 
						                 Background="White" />
					
						<TextBlock Grid.Row="3" Grid.Column="0" Margin="0,5,0,0"
						           Text="{x:Static res:UI_Labels.Groupe_NbPlaces}" />
						<xctk:IntegerUpDown Grid.Row="3" Grid.Column="1" Margin="0,5,0,0"
							Minimum="0" Maximum="50" 
							Value="{Binding Path=SelectedItem.NbPlaces}" />
					</Grid>
				</GroupBox>
			
				<GroupBox Name="gbxDivers" Header="{x:Static res:UI_Labels.Head_Divers}" Margin="0,0,0,10">
					<TextBox Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" HorizontalAlignment="Left"
					         Width="300" Height="40" Margin="0,5,0,0"
					         TextWrapping="Wrap"
					         Text="{Binding Path=SelectedItem.Commentaire}" />
				</GroupBox>
	
				<GroupBox Header="{x:Static res:UI_Labels.Head_OutilsGroupe}" Margin="0,0,0,10">
					<StackPanel Orientation="Vertical">
						<StackPanel Orientation="Horizontal" Margin="0,5,0,5">
							<Button ToolTip="{x:Static res:UI_Labels.Tltp_DocumentsGroupe_InscriptionsPdf}" 
									Style="{StaticResource ResourceKey=littleButton}"
									CommandParameter="{x:Static enum:CodesDocument.FicheInscriptionPDF}" 
									Command="{Binding Path=GenererDocumentsGroupeCommand}">
								<Image Source="/gestadh45.wpf;component/Images/btn_pdf16.png" />
							</Button>
							<TextBlock Text="{x:Static res:UI_Labels.Groupe_InscriptionsPdf}" />
						</StackPanel>
		
						<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
							<Button ToolTip="{x:Static res:UI_Labels.Tltp_DocumentsGroupe_AttestationsPdf}" 
									Style="{StaticResource ResourceKey=littleButton}"
									CommandParameter="{x:Static enum:CodesDocument.AttestationPDF}" 
									Command="{Binding Path=GenererDocumentsGroupeCommand}">
								<Image Source="/gestadh45.wpf;component/Images/btn_pdf16.png" />
							</Button>
							<TextBlock Text="{x:Static res:UI_Labels.Groupe_AttestationsPdf}" />
						</StackPanel>
		
						<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
							<Button ToolTip="{x:Static res:UI_Labels.Tltp_EffectifExcel}" 
									Style="{StaticResource ResourceKey=littleButton}"
									Command="{Binding Path=ReportCommand}"
									CommandParameter="{x:Static enum:CodesReport.ListeAdherents}" >
								<Image Source="/gestadh45.wpf;component/Images/btn_xlsx16.png" />
							</Button>
							<TextBlock Text="{x:Static res:UI_Labels.Groupe_EffectifExcel}" />
						</StackPanel>
		
						<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
							<Button ToolTip="{x:Static res:UI_Labels.Tltp_ExtractionEmails}"
									Style="{StaticResource ResourceKey=littleButton}"
									Command="{Binding Path=ExtraireEmailsGroupeCommand}">
								<Image Source="/gestadh45.wpf;component/Images/btn_search.png" />
							</Button>
							<TextBlock Text="{x:Static res:UI_Labels.Groupe_ExtractionsMails}" />
						</StackPanel>
		
						<TextBlock Text="{x:Static res:UI_Labels.Groupe_InfoInscriptionsPrisesEnCompte}" FontSize="10" TextWrapping="WrapWithOverflow" />
					</StackPanel>
				</GroupBox>
				
				<Separator Height="2" />
				
				<GroupBox Name="gbxStats" Header="{x:Static res:UI_Labels.Head_Stats}" Margin="0,0,0,10">
					<TextBlock Text="{Binding ElementName=lbxItems, Path=Items.Count, StringFormat='Nb. groupes : {0}'}" />
				</GroupBox>
			</StackPanel>
		</ScrollViewer>
	</DockPanel>
</UserControl>